Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add sudo prompt item #469

Closed
wants to merge 2 commits into from
Closed

Add sudo prompt item #469

wants to merge 2 commits into from

Conversation

re-xyr
Copy link
Contributor

@re-xyr re-xyr commented Dec 14, 2023

Description

Adds a simple prompt item that displays an icon if sudo can be called without a password.

Motivation and Context

This is most useful in reminding the user that sudo has been called recently and hasn't timed out yet.

How Has This Been Tested

It correctly displays an icon when sudo can be called without a password, and displays nothing otherwise.

  • I have tested using Linux.
  • I have tested using MacOS.

Checklist

  • I am ready to update the wiki accordingly.
  • I have updated the tests accordingly.

@re-xyr re-xyr requested a review from IlanCosman as a code owner December 14, 2023 20:57
@IlanCosman
Copy link
Owner

I don't really get why this would be useful. Could you describe a situation where this would be helpful?

@re-xyr
Copy link
Contributor Author

re-xyr commented Dec 23, 2023

I took this feature from starship, where it was initially proposed at starship/starship#816. The motivation cited was:

I want to know when user credentials are cached for running any command as I want sudo to prompt for credentials when used by untrusted programs (just to know that the program is trying to do superuser stuff, in which case I kill it).

It's notable though that in starship, the sudo prompt module is disabled by default to "avoid cluttering the prompt too much", so maybe I can set it to disabled by default as well.

Another thing mentioned by a user is that

calling sudo -n true has the side effect of resetting the credentials timeout

so we might want to mention that in the wiki if this end up being merged.

@IlanCosman
Copy link
Owner

To be honest, this seems like security theater, or at the very least encouraging really bad practices. I don't like it, sorry :(

@IlanCosman IlanCosman closed this Dec 25, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants